/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __RING_BUFFER_H
#define __RING_BUFFER_H

#define RING_BUF_SIZE                       (1024)

#define RECORD_LOST_NUM                     (1)

#define RING_BUF_OK         0
#define RING_BUF_OVERFLOW   1
#define RING_BUF_EMPTY      2

typedef struct _tRingBuf
{
#if RECORD_LOST_NUM
    uint32_t lostNum;   // lost data counter
#endif
    uint8_t* buf;       // ring buffer pointer
    int16_t in;         // ring buffer data in index
    int16_t out;        // ring buffer data out index
    int16_t size;       // ring buffer data size
}tRingBuf;

int16_t iPutDataToBuf(tRingBuf* pRingBuf, uint8_t* data, int16_t len);
int16_t iGetDataFromBuf(tRingBuf* pRingBuf, uint8_t* data, int16_t len);

#endif /* __RING_BUFFER_H */
